<?php
Class Restaurantorder extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->data['controller'] = 'restaurantorder';
        $this->load->model('Mrestaurantorder');
    }
    
    public function index()
    {
        $this->data['id_active'] = $this->getParamUri(4,3);
        $this->load->library('pagination');
        $config['per_page'] = 10;
        $this->data['page'] = $this->data['pageCurrent'] = $this->getParamUri(4,3);
        $offset = (($this->getParamUri(4,3) - 1) * $config['per_page']) > 0 ? (($this->getParamUri(4,3) - 1) * $config['per_page']) : 0;
        $data = $this->Mrestaurantorder->getRetaurantDB($config['per_page'],$offset);
        $config['base_url'] = base_url($this->uri->segment(1).'/'.$this->uri->segment(2).'/'.$this->uri->segment(3).'/');
        $config['total_rows'] = $data['count'];
        $config['uri_segment'] = 4;
        $config['uri_segment_page'] = $this->getParamUri(4,3);
        $config['suffix'] = '.html';
        $this->pagination->initialize($config);
 
        $this->data['pageg'] = $this->data['page'] - 1 > 0 ? $this->data['page'] - 1 : 0;
        $this->data['data'] = $data['data'];
        
        $this->data['action'] = 'listtaurantorder';
        $this->load->view('template/layout', $this->data);
    }
    
    public function viewlistorder()
    {
        $this->data['id_active'] = $this->getParamUri(5,3);
        $this->load->library('pagination');
        $config['per_page'] = 10;
        $this->data['page'] = $this->data['pageCurrent'] = $this->getParamUri(5,3);
        $offset = (($this->getParamUri(5,3) - 1) * $config['per_page']) > 0 ? (($this->getParamUri(5,3) - 1) * $config['per_page']) : 0;
        $data = $this->Mrestaurantorder->getListOrderDB($config['per_page'],$offset);
        $config['base_url'] = base_url($this->uri->segment(1).'/'.$this->uri->segment(2).'/'.$this->uri->segment(3).'/'.$this->uri->segment(4).'/');
        $config['total_rows'] = $data['count'];
        $config['uri_segment'] = 5;
        $config['uri_segment_page'] = $this->getParamUri(5,3);
        $config['suffix'] = '.html';
        $this->pagination->initialize($config);
 
        $this->data['pageg'] = $this->data['page'] - 1 > 0 ? $this->data['page'] - 1 : 0;
        $this->data['data'] = $data['data'];
        
        $this->data['action'] = 'viewlistorder';
        $this->load->view('template/layout', $this->data);
    }
    
    public function vieworder()
    {
        $this->data['id_active'] = $this->getParamUri(4,1);
        $this->data['data'] = $this->Mrestaurantorder->viewOrderDB($this->data['id_active']);
        
        $this->data['action'] = 'vieworder';
        $this->load->view('template/layout', $this->data);
            
    }    
                
}